import { exportUrl, downloadTemplateUrl, getPrinttypeList } from "@/api/trackingcardprint/mesTrackingCardPrintingHistory"

import { exportExcel } from "@/utils/judge"

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl
    //auth: "auth:operlog:export", //权限字段
  },
  {
    name: $i18n.t("mesTrackingCardPrintingHistory.reprint"),
    type: "primary",
    icon: "el-icon-printer",
    handleName: "repairPrint", //点击时返回的标识
    //auth: "auth:operlog:export", //权限字段
    //是否可点击；
    disabled: (data) => {
      return data == 0
    }
  }
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail" //点击时返回的标识
  }
]
// 搜索条件配置
export const searchConfig = {
  // data() {
  //   return {}}
  inline: true,
  formDesc: {
    planCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.planCode")
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.orderCode")
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.seriesCode")
    },
    seriesName: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.seriesName")
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.prodCode")
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.prodName")
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.barCode")
    },
    barcodePrintTemp: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.barcodePrintTemp")
    },
    printtime: {
      type: "datetimerange",

      label: $i18n.t("mesTrackingCardPrintingHistory.printTime"),
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss",
        searchArrKey: ["printtimeMin", "printtimeMax"]
      }
    },
    printtype: {
      type: "select",
      label: $i18n.t("mesTrackingCardPrintingHistory.printType"),
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getPrinttypeList()
        return list.data.result
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    planCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.planCode"),
      layout: 12,
      required: false
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.orderCode"),
      layout: 12,
      required: false
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.seriesCode"),
      layout: 12,
      required: false
    },
    seriesName: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.seriesName"),
      layout: 12,
      required: false
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.prodCode"),
      layout: 12,
      required: false
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.prodName"),
      layout: 12,
      required: false
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.barCode"),
      layout: 12,
      required: false
    },
    quantity: {
      type: "number",
      label: $i18n.t("mesTrackingCardPrintingHistory.quantity"),
      layout: 12,
      required: false
    },
    barcodePrintTemp: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.barcodePrintTemp"),
      layout: 12,
      required: false
    },
    printtime: {
      type: "datetime",
      label: $i18n.t("mesTrackingCardPrintingHistory.printTime"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss"
      }
    },
    printtype: {
      type: "select",
      label: $i18n.t("mesTrackingCardPrintingHistory.printType"),
      layout: 12,
      required: false,
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getPrinttypeList()
        return list.data.result
      }
    },
    userName: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.userName"),
      layout: 12,
      required: false
    },
    remark: {
      type: "input",
      label: $i18n.t("common.remark"),
      layout: 24,
      required: false
    }
  }
}
//导入数据
export const importFormDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    model: {
      type: "button",
      label:"",// $i18n.t("mesTrackingCardPrintingHistory.model"),
      layout: 24,
      required: false,
      title: $i18n.t('common.downloadTemplate'),
      style: {
        color: "#1867c0",
        fontSize: "14px"
      },
      on: {
        click: () => {
          exportExcel(downloadTemplateUrl)
        }
      }
    },
    file: {
      type: "input",
      label: $i18n.t("mesTrackingCardPrintingHistory.file"),
      layout: 24
      // required: true,
    }
  }
}
